package com.xian.wsim.util;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import java.util.Collections;
import java.util.Map;

public class ResponseUtil {

    public static <T> ResponseEntity<Map<String, T>> success(T data) {
        return ResponseEntity.ok(Collections.singletonMap("data", data));
    }

    public static ResponseEntity<Map<String, String>> error(String message, HttpStatus status) {
        return ResponseEntity.status(status).body(Collections.singletonMap("message", message));
    }
}